<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:insert="~{headAndMarkdown :: markdown}">
    <meta charset="UTF-8">
    <title>community-publish 发帖页面</title>

   <!-- &lt;!&ndash;引入自定义的import中的head 一些css，js的引入&ndash;&gt;
    <div th:insert="~{import :: head}"></div>
    &lt;!&ndash;引入自定义的import中的markdown 一些css，js的引入&ndash;&gt;
    <div th:insert="~{import :: markdown}"></div>-->


</head>
<body style="background-color: #efefef">

<!--调用navigation.html中的nav 即我们自定义的导航栏-->
<div th:insert="navigation :: nav"></div>

<div class="container-fluid main" style="background-color: white">
    <div class="row">
        <div class="col-lg-9 col-md-12 col-sm-12 col-xs-12">
            <span class="glyphicon glyphicon-plus" aria-hidden="true">发帖</span>
            <hr>

            <form action="/publish" method="post">
                <input type="hidden" name="id" th:value="${id}"/>
                <div class="form-group">
                    <label for="postTitle">发帖标题</label>
                    <input type="text" class="form-control" id="postTitle" name="postTitle"
                           placeholder="发帖标题..." th:value="${postTitle}" autocomplete="off">
                </div>
                <div class="form-group" id="question-editor">
                    <label for="postText">发帖文本</label>
                    <textarea class="form-control" id="postText" name="postText" style="display: none"
                              placeholder="此处填写具体发帖文本内容" th:text="${postText}"></textarea>
                </div>

                <script type="text/javascript">
                    $(function () {
                        var editor = editormd("question-editor", {
                            width: "100%",
                            height: 350,
                            path: "/js/lib/",
                            delay: 0,
                            watch: false,
                            placeholder: "请输入问题描述",
                            imageUpload: true,
                            imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
                            imageUploadURL: "/file/upload",
                        });
                    });
                </script>

                <!--标签-->
                <div class="form-group">
                    <label for="postTag">添加标签</label>
                    <input type="text" class="form-control" id="postTag" name="postTag"
                           th:value="${postTag}" autocomplete="off" placeholder="此处填写标签，以逗号隔开"
                           onclick="showSelectTag()"/>
                    <!--缓存标签库-->
                    <div id="select-tag" class="publish-tag-tab" >
                        <ul class="nav nav-tabs" role="tablist" >
                            <li role="presentation" th:each="selectCategory,selectCategoryStat: ${tags}"
                                th:class="${selectCategoryStat.first ? 'active':''}">
                                <a th:href="${'#'+selectCategory.category}" aria-controls="home" role="tab"
                                   data-toggle="tab" th:text="${selectCategory.category}"></a>

                            </li>
                        </ul>
                        <div class="tab-content">
                            <div role="tabpanel" th:id="${selectCategory.category}"
                                 th:each="selectCategory: ${tags}"
                                 th:class="${selectCategoryStat.first ? 'active tab-pane':'tab-pane'}">
                                <span>
                                    <span th:each="selectTag: ${selectCategory.tags}">
                                        <span class="community-tag" onclick="selectTag(this)"
                                              th:data-tag="${selectTag}"
                                              th:text="${' '+selectTag}">
                                        </span>
                                    </span>
                                </span>
                            </div>
                        </div>
                    </div>

                </div>



                <div class="container-fluid main">
                    <div class="row">
                        <div class="col-lg-9 col-md-12 col-sm-12 col-xs-12">
                            <div class="alert alert-danger col-lg-12 col-md-12 col-sm-12 col-xs-12"
                                 th:if="${error} != null" th:text="${error}">
                                错误信息弹窗
                            </div>
                        </div>
                        <div class="col-lg-3 col-md-12 col-sm-12 col-xs-12">
                            <button type="submit" class="btn btn-success btn-publish"> 发布</button>
                        </div>
                    </div>
                </div>


            </form>
        </div>
        <div class="col-lg-3 col-md-12 col-sm-12 col-xs-12">
            <h3>发帖指南</h3>
            • 发帖标题: 请用精简的语言描述您发布的问题，不超过25字 <br>
            • 发帖文本: 详细补充您的问题内容，并确保问题描述清晰直观, 并提供一些相关的资料<br>
            • 添加标签: 选择一个或者多个合适的标签，用逗号隔开，每个标签不超过10个字<br>
        </div>
    </div>
</div>

<!--引入我们自定义的footer中的foot 页脚文件 -->
<div th:include="~{footer :: foot}"></div>

</body>
</html>